package com.dmitriyp.movie.console;

import static java.lang.System.out;

import java.util.InputMismatchException;
import java.util.Scanner;

public class UserInputUtil {

    public static int readInt(Scanner scanner) {
        while (true) {
            try {
                int yearValue = scanner.nextInt();
                return yearValue;
            } catch (InputMismatchException ex) {
                out.println("Type correct Integer value");
                scanner.next();
            }
        }
    }

    public static void pressAnyKey() {
        Scanner scanner = new Scanner(System.in);
        out.println("Press enter to continue...");
        scanner.nextLine();
    }
}
